const jwt = require('jsonwebtoken')
const { tokenSerect } = require('../config')
module.exports = async (ctx, next) => {
    let token = (ctx.cookies.get('token') || '')
    ctx.request.header.Authorization = 'Bearer ' + token
    let decoded = ''
    if (token) {
        decoded = jwt.decode(token, tokenSerect);
    }
    if(0) {
        ctx.status = 401;
        ctx.body = {
          msg: ctx
        }
    }
    await next()
};